package org.feng.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.feng.condition.Condition;
import org.feng.base.entity.Result;
import org.springframework.web.bind.annotation.*;
import org.feng.entity.PubLog;
import org.feng.service.IPubLogService;
import org.feng.base.controller.BaseController;

import jakarta.annotation.Resource;

/**
 * 系统后台日志表
 *
 * @author : FengShuai
 * @since : 2024/6/27 9:24
 */
@RestController
@RequestMapping("/system/sysLog")
@Tag(name = "日志")
public class SysLogController extends BaseController {

    @Resource
    private IPubLogService sysLogService;

    /**
     * 分页列表
     *
     * @param pubLog 查询体
     * @return 返回体
     */
    @GetMapping("/pageList")
    @Operation(summary = "分页列表")
    public Result<IPage<PubLog>> pageList(PubLog pubLog) {
        return Result.success(sysLogService.page(Condition.getPage(), Wrappers.lambdaQuery(pubLog).orderByDesc(PubLog::getCreateTime)));
    }
}
